package br.usp.poli.ws;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;

import br.usp.poli.entity.Experiment;
import br.usp.poli.entity.Variable;
import br.usp.poli.util.ImportDaemon;

@WebService
public class WebLab {

	private static final ExperimentManager manager = new ExperimentManager();
	
	static {
		Thread importData = new Thread(new ImportDaemon());
		importData.setDaemon(true);
		importData.start();
	}

	@WebMethod
	public List<Experiment> listExperiments() {
		return manager.listExperiments();
	}

	@WebMethod
	public List<Variable> listVariables() {
		return manager.listVariables();
	}

	@WebMethod
	public Experiment submitExperiment(Experiment experiment) {
		return manager.submitExperiment(experiment);
	}

	@WebMethod
	public void ping() {

	}

}
